<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>使用props向组件传递数据</title>
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
</head>
<body>

<div id="app">
    <label>声音级别</label>
    <input type="number" v-model.number="soundLevel">
    <sound-icon :level="soundLevel"></sound-icon>
</div>

<script>
    Vue.component('sound-icon', {
        template: "<span>{{soundEmojis[level]}}</span>",
        props: ['level'],
        data(){
            return{
                soundEmojis: ['🔇', '🔈', '🔉', '🔊']
            }
        }
    });

    new Vue({
        el: '#app',
        data: {
            soundLevel: 0
        }
    })
</script>

</body>
</html>